package com.wealth.scsj.b_app.presenter;

import android.util.Log;

import com.wealth.scsj.b_app.base.GetOrderIncomeAndOrderQuantityBase;
import com.wealth.scsj.b_app.base.UpdateUserProfilePictureBase;
import com.wealth.scsj.b_app.bean.ShopChooseListBean;
import com.wealth.scsj.b_app.bean.StoreOperationMainBean;
import com.wealth.scsj.b_app.bean.UpdateUserProfilePictureBean;
import com.wealth.scsj.b_app.model.GetOrderIncomeAndOrderQuantityModel;
import com.wealth.scsj.b_app.model.UpdateUserProfilePictureModel;

import dkmvp.mvp.BasePresenter;
import dkmvp.net.ResponseCallback;
import okhttp3.RequestBody;

/**
 * 门店运营首页  获取今日订单量 今日收入
 */

public class GetOrderIncomeAndOrderQuantityPresenter extends BasePresenter implements GetOrderIncomeAndOrderQuantityBase.IPresenter {

    private GetOrderIncomeAndOrderQuantityBase.IModel mModel;
    private GetOrderIncomeAndOrderQuantityBase.IView mView;

    public GetOrderIncomeAndOrderQuantityPresenter(GetOrderIncomeAndOrderQuantityBase.IView view) {
        mView = view;
        mModel = new GetOrderIncomeAndOrderQuantityModel();
    }

    @Override
    public void deliverData(RequestBody requestBody) {
        addSubscription(mModel.getOrderIncomeAndOrderQuantity(requestBody, new ResponseCallback<StoreOperationMainBean>() {
            @Override
            public void onSuccess(StoreOperationMainBean result) {
                if (result.getStatusCode() == 200) {
                    mView.showSuccessMsg("获取订单量和订单收入成功", result);
                } else {
                    mView.showErrorMsg(result.getMsg());
                }
            }

            @Override
            public void onFaild(String msg) {
                mView.showErrorMsg(msg);
                Log.e("获取订单量和订单收入失败", msg + "");
            }
        }));
    }
}
